package graphics;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class SphereNaive {
	
	private static double volume(double r){
		return 4.0 / 3.0 * Math.PI * Math.pow(r, 3);
	}
	
	private static double surfacearea(double r){
		return 4.0 * Math.PI * Math.pow(r, 2);
	}

	public static void main(String[] args) {
		BufferedReader console = new BufferedReader(new InputStreamReader(
				System.in));
		double radius = 0;
		boolean radiusok = false;
		do {
			System.out.print("Enter the radius: ");
			try {
				radius = Double.parseDouble(console.readLine());
				radiusok = true;
			} catch (NumberFormatException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} while (!radiusok);
		System.out.println("Radius = " + radius);
		System.out.println("Volume = " + volume(radius));
		System.out.println("Surface area = " + surfacearea(radius));
	}

}
